﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace setfile
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {

        }
        //这个是遍历文件的方法
        public void FindFile(string dir)   //参数为指定的目录  
        {
            DirectoryInfo Dir = new DirectoryInfo(dir);
            try
            {
                foreach (DirectoryInfo d in Dir.GetDirectories())//查找子目录     
                {
                    FindFile(dir + d.ToString() + "\\");
                   // targetFile.Add(dir + d.ToString() + "\\");
                }

                foreach (FileInfo f in Dir.GetFiles("*.*")) //查找文件  
                {
                    //targetFile.Add(Dir + f.ToString());
                }
            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message);
            }
        }

        private void button9_Click(object sender, EventArgs e)
        {
            TypeFile t = new TypeFile();
            t.ShowDialog();
        }
    }
}
